{extend name="common/base" /}
{block name="title"}网站配置{/block}
<body>
<div id="wrapper">
     <!-- Navigation -->
       {block name="main"} 
	   <div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >网页模板</a></div>
	   <div id="page-wrapper">
        <div class="col-md-12 graphs">
		<div class="xs">
  	    <h3>网站配置</h3>
  	    <div class="well1 white">
        <form class="form-floating" novalidate="novalidate" ng-submit="submit()" action="{:url('Config/doc_add')}" method ='post' enctype="multipart/form-data">
          <fieldset>
            <div class="form-group">
              <label class="control-label">网站名称</label>
              <input name="title" type="text" class="form-control1" ng-model="model.name" value="{$res['title']?$res['title']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台标题</label>
              <input name="seo_title" type="text" class="form-control1" ng-model="model.name" value="{$res['seo_title']?$res['seo_title']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台描述</label>
              <input name="seo_des" type="text" class="form-control1" ng-model="model.name" value="{$res['seo_des']?$res['seo_des']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台关键词</label>
              <input name="seo_keywords" type="text" class="form-control1" ng-model="model.name" value="{$res['seo_keywords']?$res['seo_keywords']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台QQ</label>
              <input name="QQ" type="text" class="form-control1" ng-model="model.name" value="{$res['QQ']?$res['QQ']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台电话</label>
              <input name="tel" type="text" class="form-control1" ng-model="model.name" value="{$res['tel']?$res['tel']:''}" required="" >
            </div>
            <div class="form-group">
              <label class="control-label">平台网址</label>
              <input name="url" type="text" class="form-control1" ng-model="model.name" value="{$res['url']?$res['url']:''}" required="" >
            </div>
            <div class="form-group filled">
              <label class="control-label">网站开关</label>
              <select class="form-control1 ng-invalid ng-invalid-required" ng-model="model.select" required="" name="switch">
                <option value="0" {$res["switch"]?"":"selected"}>关闭</option>
                <option value="1" {$res["switch"]?"selected":""}>启用</option>
              </select>
            </div>
			<div class="form-group">
              <label class="control-label">LOGO</label>
              <input name="logo" type="file" ng-model="model.file" required="" id="exampleInputFile">
			    <input name="logo" type="hidden" value="{$res['logo']?$res['logo']:''}">
			<!-- 显示图片的地方 -->
			<div id="destination" style="margin-top:10px;">
			<img src="{$res['logo']?$res['logo']:''}" style="width:100px;"></div>

            </div>
            <div class="form-group">
              <button type="submit" class="btn btn-primary">提交</button>
              <button type="reset" class="btn btn-default">重置</button>
            </div>
          </fieldset>
        </form>
      </div>
    </div>
			<script type="text/javascript">
				document.getElementById('exampleInputFile').addEventListener('change', function() {
					var file;
					var destination = document.getElementById('destination');
					destination.innerHTML = '';

					// 循环用户多选的文件
					for(var x = 0, xlen = this.files.length; x < xlen; x++) {
						file = this.files[x];
						if(file.type.indexOf('image') != -1) { // 非常简单的交验

							var reader = new FileReader();

							reader.onload = function(e) {
								var img = new Image();
								var input = document.createElement("input");
								input.type = 'hidden';
								input.value = e.target.result;
								input.name = 'logo';
								img.src = e.target.result; // 显示图片的地方
								img.width = 100;
								destination.appendChild(img);
								destination.appendChild(input);
							};

							reader.readAsDataURL(file);
						}
					}
				});
				//隐藏提示消息
				/*window.onload = function(){
				 setInterval(function(){
				 $("#jg").fadeOut(1000);
				 }, 3000);
				 }*/
			</script>
		
		
		{/block}

  
    
